﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ChoWorkflowServer.Model;
using System.ServiceModel;
using Cinchoo.Core.Xml.Serialization;
using System.IO;
using Cinchoo.IO;

namespace ChoWorkflowServer.Model
{
    public class ChoNullDataModel : IChoDataModel
    {
        public IChoWorkflowScheduler WorkflowScheduler
        {
            get
            {
                return null;
            }

            set
            {
            }
        }

        public ChoNullDataModel()
        {
        }

        public void Dispose()
        {
        }

        public int GetTaskId(string taskName)
        {
            return 1;
        }

        public bool IsTaskExists(string taskName)
        {
            return true;
        }
        
        public int AddOrUpdateTask(string taskName, string workflowName, string taskDesc, int taskGroupId, string cmdParameters,
            int? maxNoOfRetry, int? sleepBetweenRetry, int? timeout, string hostName,
            ChoTasksDataSet.CHO_TASK_SCHEDULESDataTable taskScheduleInfo, string modifiedBy, string machineName)
        {
            return 1;
        }

        public int CloneTask(string taskName, string newTaskName, string taskGroupName, string newTaskGroupName, string modifiedBy, string machineName)
        {
            return 0;
        }

        public void DeleteTask(string taskName, string modifiedBy, string machineName)
        {
        }

        public ChoTasksDataSet.CHO_TASKSDataTable GetAllUITasks(string taskName, string taskGrpName)
        {
            return new ChoTasksDataSet.CHO_TASKSDataTable();
        }
        
        public ChoTasksDataSet.CHO_TASKSDataTable GetAllTasks(string taskName, string taskGrpName, string machineName, DateTime modifiedDate)
        {
            return new ChoTasksDataSet.CHO_TASKSDataTable();
        }

        public void SetTaskStatus(int batchId, string taskName, string scheduleName, Cinchoo.Core.ETL.ChoETLWorkflowStatus taskStatus, string modifiedBy, string modifiedByHostName, string logMsg = null, string nextRunTime = null, string machineName = null)
        {
        }

        public int AddOrUpdateTaskGroup(string taskGroupName, string taskGroupDesc, int parent, string modifiedBy, string machineName)
        {
            return 1;
        }

        public void DeleteTaskGroup(string taskGroupName, string modifiedBy, string machineName)
        {
        }
        
        public bool IsTaskGroupExists(string taskGroupName)
        {
            return true;
        }
        
        public ChoTasksDataSet.CHO_HOLIDAY_CALENDARSDataTable GetAllHolidayCalendars()
        {
            return new ChoTasksDataSet.CHO_HOLIDAY_CALENDARSDataTable();
        }
        
        public void UpdateHolidayCalendar(ChoTasksDataSet.CHO_HOLIDAY_CALENDARSDataTable calendarTable,
            ChoTasksDataSet.CHO_HOLIDAY_CALENDAR_DATESDataTable calendarDatesTable, string modifiedBy, string machineName)
        {
        }

        public ChoTasksDataSet.CHO_HOLIDAY_CALENDAR_DATESDataTable GetAllHolidayCalendarDatesById(int holidayCalId)
        {
            return new ChoTasksDataSet.CHO_HOLIDAY_CALENDAR_DATESDataTable();
        }
        
        public ChoTasksDataSet.CHO_HOLIDAY_CALENDAR_DATESDataTable GetAllHolidayCalendarDatesByName(string holidayCalName)
        {
            return new ChoTasksDataSet.CHO_HOLIDAY_CALENDAR_DATESDataTable();
        }

        public ChoTasksDataSet.CHO_TASK_SCHEDULESDataTable GetTaskSchedules(int taskId, string scheduleName)
        {
            return new ChoTasksDataSet.CHO_TASK_SCHEDULESDataTable();
        }
        
        public ChoTasksDataSet.CHO_SCHEDULE_TYPESDataTable GetTaskScheduleTypes()
        {
            return new ChoTasksDataSet.CHO_SCHEDULE_TYPESDataTable();
        }
        
        public void AddOrUpdateTaskBatch(int batchId, string taskName, string scheduleName, int taskStatus, string cmdParameters, string machineName, string logMsg,
            DateTime processStart, DateTime? processEnd, TimeSpan? duration, string nextRunTime, int exitCode, int? retryCount,
            string modifiedBy, string modifiedByHostName)
        {
        }
        
        public ChoTasksDataSet.CHO_POLICYDataTable GetAllPolicy()
        {
            return new ChoTasksDataSet.CHO_POLICYDataTable();
        }
        
        public ChoTasksDataSet.CHO_USERSDataTable GetAllUsers()
        {
            return new ChoTasksDataSet.CHO_USERSDataTable();
        }

        public void UpdateUsers(ChoTasksDataSet.CHO_USERSDataTable usersTable, string modifiedBy, string machineName)
        {
        }

        public ChoTasksDataSet.CHO_ROLESDataTable GetAllRoles()
        {
            return new ChoTasksDataSet.CHO_ROLESDataTable();
        }
        
        public ChoTasksDataSet.CHO_ROLE_USERSDataTable GetAllUserRoles(int roleId)
        {
            return new ChoTasksDataSet.CHO_ROLE_USERSDataTable();
        }
        
        public ChoTasksDataSet.CHO_ROLE_POLICYDataTable GetAllRolePolicy(int roleId)
        {
            return new ChoTasksDataSet.CHO_ROLE_POLICYDataTable();
        }
        
        public void UpdateRoles(ChoTasksDataSet.CHO_ROLESDataTable rolesTable,
            ChoTasksDataSet.CHO_ROLE_USERSDataTable userRolesTable, ChoTasksDataSet.CHO_ROLE_POLICYDataTable rolesPolicyTable, 
            string modifiedBy, string machineName)
        {
        }
        
        public ChoTasksDataSet.CHO_POLICYDataTable GetPolicyForUser(string userName)
        {
            return new ChoTasksDataSet.CHO_POLICYDataTable();
        }

        public Cinchoo.Core.ETL.ChoETLWorkflowStatus GetTaskStatus(string taskName, string scheduleName)
        {
            return Cinchoo.Core.ETL.ChoETLWorkflowStatus.ACTIVE;
        }

        public ChoTasksDataSet.CHO_DEPENDENCY_TASKSDataTable GetAllDepedencyTasks(string jobName)
        {
            return new ChoTasksDataSet.CHO_DEPENDENCY_TASKSDataTable();
        }

        public int GetTaskExitCode(string taskName, string scheduleName)
        {
            return 0;
        }

        public int CloneCalendar(string calName, string newCalName, string modifiedBy, string machineName)
        {
            return 1;
        }

        public void MoveTask(string taskName, int srcTaskGrpId, int destTaskGrpId, string modifiedBy, string machineName)
        {
        }

        public Version GetVersion()
        {
            return new Version();
        }

        public byte[] DownloadWFPlugIn(string wfPlugInFileName)
        {
            return new byte[] { };
        }

        public ChoFSFileInfo[] GetWFPlugInsFileList()
        {
            return new ChoFSFileInfo[] { };
        }

        public KeyValuePair<string, string>[] GetClusterNodePairs()
        {
            return new KeyValuePair<string, string>[] { };
        }

        public byte[] DownloadWFDef(string wfDefFileName)
        {
            return new byte[] { };
        }

        public ChoFSFileInfo[] GetWFDefsFileList()
        {
            return new ChoFSFileInfo[] { };
        }

        public byte[] DownloadWFData(string wfDataRelativeFilePath)
        {
            return new byte[] { };
        }

        public ChoFSFileInfo[] GetWFDataFileList()
        {
            return new ChoFSFileInfo[] { };
        }

        public void FireDependentTasks(int batchId, string taskName, string scheduleName, string user, string originHostName)
        {
        }

        public ChoTasksDataSet.CHO_TASK_GRPSDataTable GetAllTaskGroups()
        {
            return new ChoTasksDataSet.CHO_TASK_GRPSDataTable();
        }

        public void ImportTasks(ChoTasksDataSet dsTasks, string modifiedBy, string machineName)
        {
        }

        public bool IsUserPolicyEnabled()
        {
            return true;
        }

        public void RefreshDB()
        {
        }
    }
}
